import { Request, Response, Application } from 'express';
import { ContactController } from '../lib/controllers/crmController';

export class Routes {
    public contactController: ContactController = new ContactController();
    public routes(app: Application): void {
        app.route('/').get((req: Request, res: Response) => {
            res.status(200).send({
                message: 'GET request successful!'
            });
        });

        // Contact
        app.route('/contact')
            .get(this.contactController.getContacts)
            // Create a new Contact
            .post(this.contactController.addNewContact);

        // Contact details
        app.route('/contact/:contactId')
            .get(this.contactController.getContactWithID)
            // Update a contact
            .put(this.contactController.updateContact)
            .delete(this.contactController.deleteContact);
    }
}
